-module(chat).
-compile(export_all).

setup() ->
   net_kernel:start([foo]),
   Pid = spawn(chat,listener,[]),
   io:fwrite("processnamn: ~p",[Pid]),
   Pid.

listener() ->
   receive
      {new_msg, Message} ->
         io:fwrite("Message from Joel: " ++ Message),
         listener();
      die -> ok
   end.
